$(function() {
	$('.needPhoto').click(function() {
		$.post("mailBoxAjax_needPhoto", {
			"message.receiverUser" : $('#userid').val()
		}, function(data) {
			if (data != "true") {
				art.dialog.alert('发生未知错误！！！').time(2);
			} else {
				art.dialog.alert('索要照片成功').time(2);
			}
		});
		return false;
	});
	$('.sayHiBtn').click(function() {
		$.post("mailBoxAjax_sayHello", {
			"message.receiverUser" : $('#userid').val()
		}, function(data) {
			if (data != "true") {
				art.dialog.alert('发生未知错误！！！').time(2);
			} else {
				art.dialog.alert('打招呼成功').time(2);
			}
		});
		return false;
	});
	$('.setAttention').click(function() {
		var setAttentionA = $(this);
		if (setAttentionA.find('span').html().trim() == "关注ta") {
			$.post("mailBoxAjax_follow", {
				"luck.value1" : $('#userid').val()
			}, function(data) {
				if (data != "true") {
					art.dialog.alert('发生未知错误！！！').time(2);
				} else {
					art.dialog.alert('关注成功').time(2);
					$('.setAttention').html('<span>已关注</span>');
				}
			});
		}
		return false;
	});
	$('.showGiftBtn').click(function() {
		art.dialog.alert('该功能暂未开放！！！').time(2);
		return false;
	});
	setHobby();
	$('.fancybox').fancybox();
});

function setHobby() {
	hoby = ['上网', '研究汽车', '养小动物', '摄影', '看电影', '听音乐', '写作', '购物', '做手工艺', '做园艺', '跳舞', '看展览', '烹饪', '读书', '绘画', '研究计算机', '做运动', '旅游', '玩电子游戏'];
	personality = ['宅', '感性', '体贴', '憨厚', '稳重', '好强', '冷静', '温柔', '自我', '闷骚', '正直', '幽默', '讲义气', '孝顺', '勇敢', '有责任心', '好动', '随和'];
	var hobyData = $('.hoby').attr('defaultHobbyData');
	var hobyDatas = hobyData.split('-');
	for (var i = 0; i < hobyDatas.length - 1; i++) {
		if (hobyDatas[i] == 1) {
			var s = '<li>' + hoby[i] + '</li>';
			$('.hoby').append(s);
		}
	}
	var personalityData = $('.hoby').attr('defaultPersonalityData');
	var personalityDatas = personalityData.split('-');
	for (var i = 0; i < personalityDatas.length; i++) {
		if (personalityDatas[i] == 1) {
			var s = '<li>' + personality[i] + '</li>';
			$('.hoby').append(s);
		}
	}

}
